import request from '@/utils/request'
// 注册登录接口
export const login = data => request.post('/user/login', data)

// 获取我的收藏
export const getHouseCollect = () => request.get('/user/favorites')

// 请求用户信息
export const getUserimfo = () => request.get('/user')

// 查看我的出租
export const getChuzu = () => request.get('/user/houses')

// 获取城市列表
export const getCity = data => request.get('/area/city', {
  params: {
    level: 1 // 表示获取所有城市列表
  }
})

// 获取热门城市列表
export const getHotcity = () => request.get('/area/hot')

// 获取关键词小区查询
export const getXiaoqu = () => request.get('/area/community', {
  params: {
    name: '北京',
    id: 'AREA|88cff55c-aaa4-e2e0'
  }
})

// 发布房屋所需的条件
export const getFabu = () => request.get('/houses/params')

// 获取房屋查询条件
export const getHouses = id => request.get('/houses/condition', {
  params: { ...id }
})

export const getCityValue = name => request.get('/area/info', {
  params: { ...name }
})

// 查询房源数据
export const mapHouse = id => request.get('/area/map', {
  params: {
    id
  }
})

// 根据城市名称查询该城市信息
export const cityInfo = id => request.get('/area/info', {
  params: {
    id
  }
})

// 根据条件查询房屋
export const getHouse = data => request.get('/houses', data)
